package com.atguigu.java1.demo;

import org.junit.Test;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * 重复注解与类型注解
 * @author : leimingchao
 * @date Date : 2021年06月25日 23:08
 */
public class TestAnnotation {

    @Test
    public void test() throws Exception {
        Class<TestAnnotation> clazz = TestAnnotation.class;
        Method method = clazz.getDeclaredMethod("show");
        MyAnnotation[] annotations = method.getAnnotationsByType(MyAnnotation.class);
        Arrays.stream(annotations).forEach(e -> System.out.println(e.value()));
    }

    @MyAnnotation(value = "Hello")
    @MyAnnotation(value = "World")
    public void show(@MyAnnotation(value = "abc") String str) {

    }
}
